package com.gao.utils;

import com.gao.modules.user.dto.SysUserDto;
import com.gao.modules.user.pojo.SysUser;
import com.gao.modules.userdepart.pojo.SysUserDepart;
import com.gao.modules.userrole.pojo.SysUserRole;
import org.springframework.beans.BeanUtils;

public class SysUserUtil {
    public static SysUser UserDtoToPojo(SysUserDto sysUserDto, SysUserDepart sysUserDepart, SysUserRole sysUserRole){
        if (sysUserDto != null){
            SysUser sysUser = new SysUser();
            BeanUtils.copyProperties(sysUserDto,sysUser);
            sysUserDepart.setDepartId(sysUserDto.getDepartId());
            sysUserDepart.setUserId(sysUserDto.getId());
            sysUserRole.setRoleId(sysUserDto.getRoleId());
            sysUserRole.setUserId(sysUserDto.getId());
            return sysUser;
        }else {
            return null;
        }

    }
}
